﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MpSoft.Library.DAO.Contents;
using MpSoft.Library.DTO;
using MpSoft.Basic.Configuration;

namespace MpSoft.Library.BUSS.Contents
{
    #region  Video

    public class VideoBUSS
    {
        private const string VIDEO_ALL_KEY = "Mp.video.all-{0}";
        private const string VIDEO_BY_ID_KEY = "Mp.video.id-{0}";

        private static void VideoRemoveCache()
        {
            MpCache.RemoveByPattern(VIDEO_ALL_KEY);
            MpCache.RemoveByPattern(VIDEO_BY_ID_KEY);
        }

        public static int Video_Add(Video obj)
        {
            var result = VideoDAO.Video_Add(obj);
            return result;
        }
        public static int Video_Update(Video obj)
        {
            var result = VideoDAO.Video_Update(obj);
            return result;
        }

        public static int Video_Delete(int VideoID)
        {
            var result = VideoDAO.Video_Delete(VideoID);
            return result;
        }

        public static Video Video_ByID(int VideoID)
        {
            var list = Video_Select(VideoID, -1, false, 0);
            if (list != null)
                return list.FirstOrDefault();
            return null;
        }

        public static List<Video> Video_Select( int CategoryID, bool IsActive, int SortOrder)
        {
            return Video_Select(-1, CategoryID, IsActive, SortOrder);
        }

        public static List<Video> Video_Select(int VideoID, int CategoryID, bool IsActive, int SortOrder)
        {
            return VideoDAO.Video_Select(VideoID, CategoryID, IsActive, SortOrder);
        }

    }

    #endregion
}
